# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        潘炎珍  
# Name:         demo11
# Description:
# Author:       98745
# Date:         2019/3/16
#-------------------------------------------------------------------------------

import smtplib
from email.mime.text import MIMEText
sender='2105641563@qq.com'
password='52013142828258'
to='987455287@qq.com'
def mail():
    ret=True
    try:
        msg=MIMEText('这是一封email','plain','utf-8')
        msg['From']=sender
        msg['To']=to
        msg['Subject']='发送的一份邮件'
        server=smtplib.SMTP_SSL('smtp.qq.com',465)
        server.login(sender,password)
        server.sendmail(sender,[to,],msg.as_string())
        print(msg.as_string())
        server.quit()
    except Exception as e:
        ret=False
        print(e)
    return ret
ret=mail()
if set:
    print('邮件发送成功')
else:
    print('邮件发送失败')

